package com.jpemartin.jgt;

import java.awt.Rectangle;

/**
 * The object will follow another object with a given (x,y) offset.
 * 
 * @author jpmartin
 */
public class MoveOffset implements MoveControl {
   
   // the object we follow
   protected Rectangle _trailed;
   // our distance to _trailed
   protected int _ox, _oy;
   
   /** 
    * @param trailed : the object to be followed
    * @param ox : horizontal distance to trailed
    * @param oy : vertical distance to trailed
    */
   public MoveOffset(Rectangle trailed, int ox, int oy) {
      _trailed = trailed;
      _ox = ox;
      _oy = oy;
   }
   
   public void move(Rectangle moved) {    
      moved.x = _trailed.x+_ox;
      moved.y = _trailed.y+_oy;
   }
}
